Skip to content

[feat] Expose message replication metadata#493

Merged
shibd merged 2 commits into
apache:masterfrom
shibd:codex/expose-message-replication-metadata
Jun 23, 2026
Merged

[feat] Expose message replication metadata#493
shibd merged 2 commits into
apache:masterfrom
shibd:codex/expose-message-replication-metadata

Conversation

@shibd

@shibd shibd commented Jun 23, 2026

Copy link
Copy Markdown
Member

What changed

  • Expose Message.isReplicated() and Message.getReplicatedFrom() from the Node.js binding.
  • Add TypeScript definitions for both methods.
  • Assert the default non-replicated message behavior in the end-to-end test and type-check sample.

Why

Consumers need access to Pulsar replication-origin metadata to distinguish locally produced messages from messages geo-replicated from another cluster. This implements #480 on top of the C++ client API added in apache/pulsar-client-cpp#583.

isReplicated() is derived from whether getReplicatedFrom() returns a non-empty cluster name.

Fixes #480

Validation

  • npm run type-check
  • npx clang-format-lint src/Message.cc src/Message.h
  • npx node-pre-gyp configure build
  • node -e "const Pulsar=require('./'); console.log(typeof Pulsar.Message.prototype.isReplicated, typeof Pulsar.Message.prototype.getReplicatedFrom)"
  • npx eslint tests/end_to_end.test.js (passes with existing warnings)

@shibd shibd marked this pull request as ready for review June 23, 2026 03:33
@shibd shibd changed the title [codex] Expose message replication metadata [feat] Expose message replication metadata Jun 23, 2026
@shibd shibd self-assigned this Jun 23, 2026
@shibd shibd added this to the 1.18.0 milestone Jun 23, 2026
Comment thread src/Message.cc Outdated
@shibd shibd merged commit 01b6d89 into apache:master Jun 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose isReplicated() / getReplicatedFrom() on the Message object

2 participants